<script setup>
import {ElMessage} from "element-plus";
import {version,getCurrentInstance} from "vue"
import axios from "axios";
const{proxy} = getCurrentInstance()

axios.defaults.baseURL = 'http://localhost/api/'

function up() {
  let d = new FormData()
  d.append('user',"里斯")
  d.append('file',proxy.$refs.file.files[0])
  axios.post('u6',d)
      .then(res => {
        ElMessage.success(res.data.msg)
      })
      .catch(err => console.log(err))
}


</script>

<template>
  <div id="app">
    <el-row>
      <h3>hello Vue {{version}}</h3>
    </el-row>

    <el-row>
      <input type="file" name="file" ref="file">
      <el-button @click="up" type="primary">手写上传</el-button>
    </el-row>

    <hr>
    <hr>
    <hr>
    <el-row>
<!--      @click="up"-->
      <el-button  type="primary">vue单文件上传</el-button>
      <el-button type="success">success</el-button>
      <el-button type="info">info</el-button>
    </el-row>
  </div>
</template>

<style>
#app {
  margin-top: 20px;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>

